package com.gee.spring.boot.rpf.util.context;

import org.springframework.context.ConfigurableApplicationContext;

/**
 * desc:
 *
 * @author gee wrote on  2020-10-17 08:41:26
 */
public class ApplicationContextUtil {

    private static ConfigurableApplicationContext applicationContext;

    public static void setApplicationContext(ConfigurableApplicationContext context){
        applicationContext = context;
    }

    public static Object getBean(String beanName){
        return applicationContext.getBean(beanName);
    }

    public static <T> T getBean(Class<T> cla){
        return applicationContext.getBean(cla);
    }

    public static <T> T getBean(String beanName, Class<T> cla){
        return applicationContext.getBean(beanName,cla);
    }
}
